package StreamDemo.demo2;

import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;

public class test {
    public static void main(String[] args){
        // 创建一个集合存储数据
        ArrayList<Integer> list = new ArrayList<>();
        // 添加数据
        Collections.addAll(list,1,2,3,4,5,6,7,8,9,10);
        // 过滤奇数
        Set<Integer> s = list.stream().filter(num -> num % 2 == 0).collect(Collectors.toSet());
    }
}
